<template>
	<el-dialog title="需求信息补录" :visible.sync="visible" width="700px" :center="false" >
		<div slot="title" class="dialog-header-title">
			<i class="el-icon-edit-outline"></i>
			<span>需求信息补录</span>
		</div>

		<div class="reequirementBody">
			<el-form :inline="false" label-width="140px" size="mini" ref="form" :model="form" :rules="rules">
				<el-row>
					<el-col :span="24">
						<el-form-item label="需求编号:" prop="qmsNo"  >
							<el-input v-model="form.qmsNo" placeholder="需求编号" disabled> </el-input>
						</el-form-item> 
					</el-col>
					
					<el-col :span="24">
						<el-form-item label="需求名称:" prop="qmsName"  >
							<el-input v-model="form.qmsName" placeholder="需求名称" disabled> </el-input>
						</el-form-item> 
					</el-col>
					
					<el-col :span="24">
						<el-form-item label="批次号:" prop="batchNum"  >
							<el-select v-model="form.batchNum"  clearable style="width: 100%" placeholder="批次号"   disabled>	
								<el-option v-for="item in dict('SMP0010')" :key="item.itemCode"
									:label="item.itemName" :value="item.itemCode">
								</el-option>
							</el-select>
						</el-form-item> 
					</el-col>
					<el-col :span="24">
					<el-form-item label="主系统:">
						<el-select v-model="form.mainSystemNo" clearable  style="width: 100%" filterable remote
							reserve-keyword placeholder="主系统"   disabled>
							<el-option v-for="item in systemListAll" :key="item.systemNo"
								:label="item.systemName" :value="item.systemNo">
								<span style="float: left;margin-left: 3px;">{{ item.systemNo }}</span>
								<span style="float: right;margin-right: 3px;">{{ item.systemName }}</span>
							</el-option>
						</el-select>
					</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="ESB需求编号:" prop="esbQmsNo"  >
							<el-input v-model="form.esbQmsNo" placeholder="ESB需求编号" > </el-input>
						</el-form-item> 
					</el-col>
					<el-col :span="24">
						<el-form-item label="ESB需求名称:" prop="esbQmsName"  >
							<el-input v-model="form.esbQmsName" placeholder="ESB需求名称" > </el-input>
						</el-form-item> 
					</el-col>
					<el-col :span="24">
						<el-form-item label="外联ESB需求编号:" prop="oesbQmsNo"  >
							<el-input v-model="form.oesbQmsNo" placeholder="外联ESB需求编号" > </el-input>
						</el-form-item> 
					</el-col>
					<el-col :span="24">
						<el-form-item label="外联ESB需求名称:" prop="oesbQmsName"  >
							<el-input v-model="form.oesbQmsName" placeholder="外联ESB需求名称" > </el-input>
						</el-form-item> 
					</el-col>
					
					
					
					
				</el-row>
			</el-form>
		</div>
		<span slot="footer" class="dialog-footer">
			<!-- <el-button @click="visible = false" size="mini">取 消</el-button>
			<el-button type="primary" plain @click="submit" size="mini">确 定</el-button>
			 -->
			
			<el-button type="primary" plain @click="submit" size="mini">
				<i class="el-icon-check"></i>
				确定</el-button>
			<el-button @click="visible = false" size="mini">
				<i class="el-icon-close"></i>
				取消</el-button>
		</span>
	</el-dialog>
</template>
<script>
	"use strict";
import {updateRequirement} from '@/api/requirementBatch.js';


	export default {
		data() {
			return {
				visible: false,
				proLoading:false,
				form: {
					 qmsNo: "",
					qmsName: "",
					batchNum: "",
					mainSystemNo: "",
					esbQmsNo: "",
					esbQmsName: "",
					oesbQmsNo:"", 
					oesbQmsName:"", 
				},
				rules:{
					/* esbQmsNo: [{
						required: true,
						message: '请输入ESB子需求编号',
						trigger: 'blur'
					}],
					esbQmsName: [{
						required: true,
						message: '请输入ESB子需求名称',
						trigger: 'blur'
					}],
					 */
				},
	
			}

		},
		methods: {
			
			ShowDialog(data) {
				Object.assign(this.form,data);
				this.visible = true;
				
			},
			handleCancel(e) {
				this.visible = false;
			},
			submit() {//新增
				this.$refs["form"].validate((valid)=>{
					if(valid){
						updateRequirement(this.form).then(response => {
							if(response.data.code == "0000"){
								this.$message.success(response.data.message);
							}else{
								this.$message.error(response.data.message);
							}
							this.visible = false;
							this.$emit("fresh")
							
						}).catch(error => {
							this.$message.error(error.message);
						});
						
					}
				});
			},
		}
	};
</script>

<style scope>
	.reequirementBody{
		padding:5px 10px;
	} 
</style>
